import requests

from tools.get_headers import get_headers


class Ihrm_Test_Api(object):


    @classmethod
    def login_api(cls,data):
        result=requests.post(url="http://ihrm.itheima.net/api/sys/login",json=data)
        return result


    #部门添加接口
    @classmethod
    def add_department(cls,data):
        header,session=get_headers()

        result=session.post(url="http://ihrm.itheima.net/prod-api/company/department",headers=header,json=data)
        print(result.json())



        return result



    #部门删除入口
    @classmethod
    def delete_department(cls,data):
        header, session = get_headers()

        result = session.post(url="http://ihrm.itheima.net/prod-api/company/department", headers=header, json=data)

        number = result.json().get("data").get("_id")


        result1 = session.delete(url="http://ihrm.itheima.net/prod-api/company/department/" + number, headers=header)
        print(result1.json())
        return result1
if __name__ == '__main__':

    Ihrm_Test_Api.delete_department()








